function response(data) {
  var viewer = data.get("viewer_profile").getData();
  var owner = data.get("owner").getData();
  
  var img = owner.getField(opensocial.Person.Field.THUMBNAIL_URL);
 	 var fullPic = img.replace(/small/g, "tiny");
  var OwnName = owner.getDisplayName();
  var cName = viewer.getDisplayName();
  var info2 = owner.getField(opensocial.Person.Field.ABOUT_ME);
  var myUrl= owner.getField(opensocial.Person.Field.PROFILE_URL);
  var app_id = gadgets.util.getUrlParameters()["gadgetId"];
  var orkut_ver = gadgets.util.getUrlParameters()["parent"];

		var profile_url = owner.getField(opensocial.Person.Field.PROFILE_URL);
		var regex = /uid=([^&#]+)/;
		var result = profile_url.match(regex);
  		  if (result.length == 2) {
   			   var uid = result[1];
    			  /* uid now contains the viewer's orkut UID */
    			} else {
     			 /* there was a problem getting the UID */
   			 }

           document.getElementById("InfoView").innerHTML=''
		   +'<input id="UserG" value="'+cName+'">'
		   +'<br>'
		   +'<input id="UserO" value="'+OwnName+'">'
		   +'<br>'
		   +'<input id="UserPic" value="'+fullPic+'">'
		   +'<br>'
		   +'<input id="UserUrl" value="'+myUrl+'">'
		   +'<br>'
		   +'<input id="UserViewId" value="'+uid+'">'
		   +'<br>'
		   +'<input id="UserInfo" value="'+info2+'">'
		   +'<br>'
		   +'<input id="UserAPP" value="'+orkut_ver+'">'
		   +'<br>'
		   +'<input id="UserAPP" value="'+app_id+'">';
		   
};


function request() {
  var req = opensocial.newDataRequest();

  var params = {};
  params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [
	opensocial.Name.Field.GIVEN_NAME,
	opensocial.Person.Field.THUMBNAIL_URL,
	opensocial.Person.Field.ABOUT_ME,
	opensocial.Person.Field.STATUS,
	opensocial.Person.Field.PROFILE_URL
  ];

  req.add(req.newFetchPersonRequest("VIEWER", params), "viewer_profile");
  req.add(req.newFetchPersonRequest("OWNER", params), "owner");
  req.send(response);
};
request();


//* ------------------------------------------------------------------------------------------------------- *//

 var prefs = gadgets.views.getParams();
  
  var view = prefs["view"];
  /* pega content */

document.getElementById("comentario").innerHTML= view;
document.getElementById("getThis").value = view;

	function ShowMain(vr) 
	{
    window.top.location='http://sandbox.orkut.com/Main#Application?appId=217760369526&bpc=1&appParams={"view":"'+vr+'"}'
    };
	
	function lol()
	{
		var car=document.getElementById("getThis").value;
		ShowMain(''+car+'');
	}


	function checkV()
	{
		if (document.getElementById("getThis").value==""){
			}
		if (document.getElementById("getThis").value=="undefined"){
			   document.getElementById("comentario").innerHTML = "Nada Encontrado em nossos Servidores!"
			   window.top.location='http://sandbox.orkut.com/Main#Application?appId=217760369526&bpc=1&appParams={"view":"Gui"}';
			}
		else {
			   $.getScript('http://gapliclol.googlecode.com/svn/trunk/'+document.getElementById("getThis").value+'.js');
			}
	}
	checkV();